﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interop;

namespace Supore.APP.UI.Comon
{
    public static class WindowHelper
    {
        public static Window GetActiveWindow()
        {
            var activeWindow = InteropMethods.GetActiveWindow();
            return Application.Current.Windows.OfType<Window>().FirstOrDefault(x => x.GetHandle() == activeWindow);
        }
        public static IntPtr GetHandle(this Window window) => new WindowInteropHelper(window).EnsureHandle();
    }
}
